<?php

namespace co2\dev\v0_0_0;

class Juggling

{
	
	public static function
	objectToArray
	(
		$object
	)
	# http://www.if-not-true-then-false.com/2009/php-tip-convert-stdclass-object-to-multidimensional-array-and-convert-multidimensional-array-to-stdclass-object/
	{
		
		if(is_object($object))
		$object=get_object_vars($object);
 
		if(is_array($object))
		return array_map(__METHOD__, $object);
		
		else
		return $object;
	}
	
	public static function
	arrayToObject
	(
		$array
	)
	# http://www.if-not-true-then-false.com/2009/php-tip-convert-stdclass-object-to-multidimensional-array-and-convert-multidimensional-array-to-stdclass-object/
	{
		if(is_array($array)) 
		return(object) array_map(__METHOD__,$array);
		else
		return $array;
	}
}
